{% extends "GairalAdminBundle::layout.html.twig" %}

{% block bodyAdmin %}
<section id="InterestsAdmin" class="content">
    <div class="row-fluid">
        <table class="table table-striped table-condensed">
            <caption>
                <h4>Interests</h4>
            </caption>
            <thead>
                <tr>
                    <th>Interest name</th>
                    <th>Description</th>
                    <th>Category</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="4">
                        <div class="modal hide" id="addCategory">
                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                <h3>Add new Interest</h3>
                            </div>
                            {{ render(controller("GairalAdminBundle:InterestAdmin:add")) }}
                        </div>
                        <div class="btn-toolbar text-center">
                            <a href="#addCategory" data-toggle="modal" class="btn btn-large btn-primary">
                                Add new Interest
                                <i class="icon-white icon-plus"></i>
                            </a>
                        </div>
                    </td>
                </tr>
    {% for interest in listInterests %}
                <tr>
                    <td>{{ interest.name }}</td>
                    <td>{{ interest.description }}</td>  
                    <td>{{ interest.category.name }}</td>   
                    <td>
                        <div class="btn-toolbar">
                            <div class="btn-group">
                                <a href="{{ path('AdminInterestModify', {'id': interest.id})}}" data-toggle="modal" class="btn btn-small btn-inverse">
                                    Edit
                                    <i class="icon-white icon-edit"></i>
                                </a>
                                                        {% if interest.displayOrder != maxOrder %}
                                <a href="{{ path('AdminInterestUp', {'id': interest.id})}}" class="btn btn-small">
                                    <i class="icon-arrow-down"></i>
                                </a>
                                                        {% endif %}
                                                        {% if interest.displayOrder > 0 %}
                                <a href="{{ path('AdminInterestDown', {'id': interest.id})}}" class="btn btn-small">
                                    <i class="icon-arrow-up"></i>
                                </a>
                                                        {% endif %}
                            </div>
                            <a href="#remove_{{interest.id}}" data-toggle="modal" class="btn btn-small btn-danger">
                                Remove
                                <i class="icon-white icon-trash"></i>
                            </a>
                        </div>
                        <div class="modal hide" id="remove_{{interest.id}}">
                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                <h3>Remove Interest</h3>
                            </div>
                            <div class="modal-body alert">
                                <p>
                                    Are you sure to want to remove the Interest: "{{ interest.name }}" ?
                                </p>
                            </div>
                            <div class="modal-footer">
                                <a href="{{ path('AdminInterest') }}" class="btn btn-info" data-dismiss="modal">
                                    Cancel
                                </a>
                                <a href="{{ path('AdminInterestRemove', {'id': interest.id})}}" class="btn btn-danger">
                                    Remove
                                    <i class="icon-white icon-trash"></i>
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
    {% else %}
                no interest
    {% endfor %}

            </tbody>
        </table>
    </div>
</section>
{% endblock %}